package java14;

public class Test {
    public static void main(String[] args) {
        Student a = new Student("A");
        Student b = new Student("A");
        System.out.println(a.equals(b));

        Person person = new Person("Alice", 30);

        // 自动生成的 toString() 方法
        System.out.println(person); // 输出: Person[name=Alice, age=30]

        // 自动生成的 getter 方法
        System.out.println("Name: " + person.name()); // 输出: Name: Alice
        System.out.println("Age: " + person.age());   // 输出: Age: 30

        // 自定义方法
        System.out.println(person.greet()); // 输出: Hello, my name is Alice and I am 30 years old.
    }
}
